package game.efekti;

import util.INIGroup;
import util.Util;
import game.Character;
import game.EffectStage;
import game.Item;
import game.MagicEffect;
import game.Item.ItemType;

public class MaxMana extends MagicEffect {
	int inc = 0;
	
	@Override
	public boolean loadFromFile(INIGroup grupa) {
		tag = grupa.getString("Tag");
		inc = grupa.getInteger("Bonus", 0);
		return true;
	}

	@Override
	public void init() {}

	@Override
	public EffectStage getStage() {
		return EffectStage.ConstantEffect;
	}

	@Override
	public boolean canHazTip(ItemType tip) {
		return tip != Item.ItemType.POTION;
	}

	@Override
	public void doEffect(Character caster, Character target) {
		caster.setMaxMana(caster.getMaxMana() + inc);
	}

	@Override
	public String toString() {
		return "+" + inc + " mana";
	}

	@Override
	public void generateForLevel(int lvl) {
		inc = Util.getRndInt(lvl / 2 + 1, lvl * 2);
	}

	@Override
	public boolean stacksWith(MagicEffect e) {
		return e instanceof MaxMana;
	}

	@Override
	public void absorb(MagicEffect e) {
		inc += ((MaxMana)e).inc;
	}

}
